package com.cw.gui;

import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;
import java.util.Vector;

import javax.swing.Icon;

import com.cw.po.Cpaction;

class IconData implements java.io.Serializable {
	private Vector<Cpaction> actions = new Vector<Cpaction>();
	private Object m_data;
	private Icon m_icon;
	private Icon m_openIcon;
	private boolean subCategory;

	public IconData(Icon icon, Object data, Set<Cpaction> actions, boolean subCategory) {
		m_icon = icon;
		m_openIcon = null;
		m_data = data;
		this.subCategory = subCategory;
		if(actions!=null){
			for(Cpaction act:actions){
				if(act.getSub()==subCategory){
					this.actions.add(act);
				}
			}			
		}
	}

	public Vector<Cpaction> getActions() {
		return actions;
	}

	public Icon getIcon() {
		return m_icon;
	}
	
	public Object getObject(){
		return m_data;
	}

	public Icon getOpenIcon() {
		return m_openIcon != null ? m_openIcon : m_icon;
	}

	public void setActions(Vector<Cpaction> acts) {
		this.actions = acts;
	}

	public String toString() {
		return m_data.toString();
	}
}
